home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Alles Voor Internet / Tout Pour Internet
/
alles voor internet.iso
/
MacInternet™
/
Telnet
/
NCSA
/
tn3270 2.4d7 source
/
NCSA⁄BYU TCP⁄IP
/
cksum.a
< prev
next >
Wrap
Text File
|
1991-06-27
|
1KB
|
59 lines
blanks off
case on
; public _ipcheck,_tcpcheck
ipcheck PROC EXPORT ; (integer) sum = ipcheck(buf:Ptr, wdcnt:integer)
clr.l d1
move.l 8(sp),d1 ; move w on Aztec (16b) move l on MPW (32b)
move.l 4(sp),a0
subq.l #1,d1
clr.l d0
again
add.w (a0)+,d0
bcc.s nocar
addq.w #1,d0
nocar
dbra d1,again
andi.w #$0ffff,d0
eori.w #$0ffff,d0
rts
ENDPROC
tcpcheck PROC EXPORT ; (integer) sum = tcpcheck(phd: Ptr,buf:Ptr, btcnt:integer)
clr.l d1
clr.l d0
move.l 4(sp),a0
moveq #5,d1
again2 ; check the 12 byte pseudo header.
add.w (a0)+,d0
bcc.s nocar2
addq.w #1,d0
nocar2
dbra d1,again2
move.l 8(sp),a0
move.l 12(sp),d1 ; move w on Aztec (16b) move l on MPW (32b)
asr.w #1,d1
bcc.s onward
move.l 12(sp),d2
clr.b 0(a0,d2)
addq.w #1,d1
onward
subq.w #1,d1
again3
add.w (a0)+,d0
bcc.s nocar3
addq.w #1,d0
nocar3
dbra d1,again3
tcpend
andi.w #$0ffff,d0
eori.w #$0ffff,d0
rts
ENDPROC
END